package com.megvii.koala.guard;

/**
 * Created by linyue on 16/1/8.
 */
public abstract class BoxValidator
{
    protected BoxValidatorListener listener;

    abstract public boolean validate(int id, String address);

    abstract public void release();

    public void setListener(BoxValidatorListener listener)
    {
        this.listener = listener;
    }

    protected void postValidResult(final int id, boolean valid)
    {
        if (listener != null)
        {
            listener.onValidateResult(id, true);
        }
    }

    public interface BoxValidatorListener
    {
        public void onValidateResult(int id, boolean valid);
    }
}
